#include "CheckLadderBelow.h"
#include "Player.h"
#include "Ladder.h"
#include "CollisionTypes.h"

CheckLadderBelow::CheckLadderBelow(Player* player) : _player(player)
{
	_component |= COMPONENT_COLLIDEABLE;

	_ct.push_back(CT_LADDER_CHECK);
	_mf.push_back(CT_LADDER);
	_type = "CheckLadderBelow";
	_killMe = false;
}


CheckLadderBelow::~CheckLadderBelow(void){}

void CheckLadderBelow::move()
{

}

void CheckLadderBelow::update()
{
	_killMe = true;
}

void CheckLadderBelow::initialize()
{

}

void CheckLadderBelow::clean()
{

}

sf::FloatRect CheckLadderBelow::collisionBox(int type)
{
	return _player->collisionBox(GROUND_SENSOR);
}

void CheckLadderBelow::signalPlayer(Ladder* ladder)
{
	if ((_player->flags() & LADDER_BELOW) != LADDER_BELOW)
	{
		_player->setFlag(LADDER_BELOW);
		_player->setLadder(ladder);
	}
}